require 'httparty'
require 'json'
class Pushco

  # Example:
  #   >> Pushco.new("YOUR_API_KEY", "YOUR_API_SECRET")
  # Arguments:
  #   String

  def initialize api_key, api_secret

    if ((api_key.nil? || api_key.empty?) && (api_secret.nil? || api_secret.empty?))
      p "Please Provide Both API key and API Secret!"
    end

    @api_key = api_key
    @api_secret = api_secret

  end


  # Example:
  #   >> Pushco.push("Hello Mum I am on TV", {:url => 'http://sky.com'})
  # Arguments:
  #   String and Hashmap

  def push messsage, options = {}
    connect_to_push(messsage, options)
  end

  def connect_to_push(message, options)

    data = {:message => message,
            :api_key => @api_key,
            :api_secret => @api_secret
    }.merge(options)

    p HTTParty.post('https://api.push.co/1.0/push', {:body => data}).body
  end

end
